package com.bot.pms.project.controller;

import com.bot.pms.common.domain.Message;
import com.bot.pms.project.domain.bo.ProjectBo;
import com.bot.pms.project.domain.bo.ProjectPageQuery;
import com.bot.pms.project.service.ProjectService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class ProjectController {

    @Resource
    private ProjectService projectService;


    @PostMapping("/pageQuery.do")
    public Message pageQuery(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize, @RequestBody ProjectPageQuery projectPageQuery){

        projectPageQuery.setPageNo(pageNo);
        projectPageQuery.setPageSize(pageSize);
        Message message = projectService.pageQuery(projectPageQuery);
        return message;
    }

    @PostMapping("/add.do")
    public Message add(@RequestBody ProjectBo projectBo){

        Message message = projectService.addProject(projectBo);
        return message;
    }

    @GetMapping("/viewDetail.do")
    public Message add(@RequestParam("id") Long id){

        Message message = projectService.viewDetail(id);
        return message;
    }

}
